﻿<%
Const SystemDatabaseType = 0     '系统数据库类型，2为MYSQL数据库，MYSQL数据库必须安装MYSQL ODBC Driver驱动，1为MS SQL2000数据库，0为MS ACCESS 2000数据库
Const InstallDir = "/"     '网站目录,务必认真填写
Const SkinDir = "Skin/"     '网站皮肤目录,务必认真填写
Const TemplateDir = "Templates/"     '网站模板目录,务必认真填写
Const InstallCookies = "WangKaiCMS"     '网站Cookies,同一个服务使用WangKaiCMS时必须改写
Const SystemEdition = "All"     '系统版本
Const SystemVersion = "6.9"     '系统版本
Const SystemBuildDate = "Build 20200416"     '系统版本号
Const Charset = "UTF"     '系统编码
Const TablePrefix = ""     '数据库前缀Cms_
Const EnableStopInjection = True     '是否启用防SQL注入功能，True为启用，False为禁用
Const NeedCheckComeUrl = True     '是否需要检查外部访问，True为启用，False为禁用
Const IsDeBug = True    '错误提示开关，二次开发时开启可提示相关错误

'如果是ACCESS数据库，请认真修改好下面的数据库的文件名
Const AccessDB = "DataBase/#Wang#Kai#_Data.mdb"     'ACCESS数据库的文件名，请使用相对于网站根目录的的绝对路径

'如果是SQL数据库，请认真修改好以下数据库选项
Const SqlUsername = "sa"     'SQL数据库用户名
Const SqlPassword = "sa"     'SQL数据库用户密码
Const SqlDatabaseName = "WangKai_Data"     'SQL数据库名
Const SqlHostIP = "(local)"     'SQL主机IP地址。本地（指网站与数据库在同一台服务器上）可用“(local)”或“127.0.0.1”，非本机（指网站与数据库分别在不同的服务器上）请填写数据库服务器的真实IP）

'如果是MYSQL数据库，请认真修改好以下数据库选项
Const MySqlUsername = "root"     'MYSQL数据库用户名
Const MySqlPassword = "root"     'MYSQL数据库用户密码
Const MySqlDatabaseName = "WangKai_Data"     'MYSQL数据库名
Const MySqlDriver  = "{MySQL ODBC 5.1 Driver}"     'MYSQL数据库ODBC驱动
Const MySqlcharset = "gb2312"     'MYSQL编码
Const MySqlHostIP = "localhost"     'MYSQL主机IP地址。本地（指网站与数据库在同一台服务器上）可用“localhost”或“127.0.0.1”，非本机（指网站与数据库分别在不同的服务器上）请填写数据库服务器的真实IP）

'以下代码请勿改动
Call CheckInstall()

Dim Conn, IsConn
Dim WK_True, WK_False, WK_Now, WK_OrderType, WK_DatePart_D, WK_DatePart_Y, WK_DatePart_M, WK_DatePart_W, WK_DatePart_H
Dim dbquery:dbquery = 0
IsConn = True     'Conn 是否开启
Sub OpenConn()
	If IsDeBug = True Then On Error Resume Next
	If IsObject(Conn) Then exit sub
	Dim ConnStr
	If SystemDatabaseType = 0 Then
		ConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(InstallDir & AccessDB)
	ElseIf SystemDatabaseType = 1 Then
		ConnStr = "Provider = Sqloledb; User ID = " & SqlUsername & "; Password = " & SqlPassword & "; Initial Catalog = " & SqlDatabaseName & "; Data Source = " & SqlHostIP & ";"
	Else
		ConnStr = "Driver=" & MySqlDriver & ";Server=" & MySqlHostIP & ";charset=" & MySqlcharset & ";Database=" & MySqlDatabaseName & ";User=" & MySqlUsername & ";Password=" & MySqlPassword & ";Socket=MySQL;Option=3;"
	End If
	Set Conn = Server.CreateObject("ADODB.Connection")
	Conn.Open ConnStr
	If SystemDatabaseType = 2 Then Conn.CursorLocation=3
	If Err And IsDeBug = True Then
		Err.Clear
		Set Conn = Nothing
		Format_Redirect(InstallDir & "Include/Error.asp?Action=Error&Text="&Server.UrlEncode("数据库连接出错，请检查Conn.asp文件中的数据库参数设置。"))
		Response.End()
	Else
		IsConn = False     'Conn 是否开启
	End If
	If SystemDatabaseType = 0 Then
		WK_True = "True"
		WK_False = "False"
		WK_Now = "Now()"
		WK_OrderType = " asc"
		WK_DatePart_D = "'d'"
		WK_DatePart_Y = "'yyyy'"
		WK_DatePart_M = "'m'"
		WK_DatePart_W = "'ww'"
		WK_DatePart_H = "'h'"
	Else
		WK_True = "1"
		WK_False = "0"
		WK_Now = "GetDate()"
		WK_OrderType = " desc"
		WK_DatePart_D = "d"
		WK_DatePart_Y = "yyyy"
		WK_DatePart_M = "m"
		WK_DatePart_W = "ww"
		WK_DatePart_H = "hh"
	End If
End Sub

Sub CloseConn()
	On Error Resume Next
	If IsObject(Conn) Or Conn.State = 1 Then
		Conn.Close
		Set Conn = Nothing
	End If
	Set regEx = Nothing
End Sub

Sub CheckInstall()
	Dim objFso
	Set objFso = Server.Createobject("Scripting.FileSystemObject")
	If (objFso.FileExists(Server.MapPath(InstallDir & "Install/Install.lock"))) = False Then Format_Redirect(InstallDir & "Install")
	Set objFso = Nothing
End Sub
%>